from sqlalchemy import create_engine
from sqlalchemy.orm import sessionmaker,scoped_session
from sqlalchemy.ext.declarative import declarative_base

Base = declarative_base()

echo = False
# 初始化数据库连接:
# engine = create_engine('sqlite:///sqlite.db?check_same_thread=False', echo=True)
# engine = create_engine('mysql+pymysql://root:hnsjb213@mysql8:3306/test')
engine = create_engine('mysql+pymysql://sifating_dati:Hnsjb_106@192.168.3.106:3306/sifating_dati',pool_size=10, max_overflow=10,pool_timeout=30,pool_recycle=360,echo=echo)

# engine = create_engine('mysql+pymysql://article_analyse:article65795882@47.111.152.143:3306/article_analyse')

# 创建DBSession类型:
# scoped_session
Session = sessionmaker(bind=engine)

# Session = Session()
# with Session() as s:
#     print(s)
# with Session() as s:
#     print(s)